home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WOPTIMA.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  5.4 KB  |  167 lines

  1. //
  2. // woptima.hpp -- Private functions.
  3. //
  4.  
  5. #ifndef _WOPTIMA_HPP_INCLUDED
  6. #define _WOPTIMA_HPP_INCLUDED
  7.  
  8. #ifndef _WDEF_HPP_INCLUDED
  9. #include "wdef.hpp"
  10. #endif
  11.  
  12. #ifndef _WTOOLBAR_HPP_INCLUDED
  13. #include "wtoolbar.hpp"
  14. #endif
  15.  
  16. #ifndef _WDIALOG_HPP_INCLUDED
  17. #include "wdialog.hpp"
  18. #endif
  19.  
  20. #ifndef _WPROPSHT_HPP_INCLUDED
  21. #include "wpropsht.hpp"
  22. #endif
  23.  
  24. struct __OptimaRTControl {
  25.     WUInt       size;
  26.     WLong       controlID;
  27.     WRect       r;
  28.     WStyle      style;
  29.     WStyle      ex_style;
  30.     char        text[];
  31. };
  32.  
  33. class WWindow;
  34. class WModule;
  35. class WFont;
  36. class WTransaction;
  37. class WQuery;
  38. class WDataSource;
  39.  
  40. #ifndef _WIN16
  41. #undef GetObject
  42. #if defined( _UNICODE )
  43.     #define GetObject GetObjectW
  44. #else
  45.     #define GetObject GetObjectA
  46. #endif
  47. #endif
  48.  
  49. class WCMCLASS WOptima {
  50.  
  51.     public:
  52.  
  53.         static WBool CreateControl( WWindow * parent,
  54.                                     const WResourceID & parentID,
  55.                                     WWindow * control, long controlID,
  56.                                     WFont * font = NULL,
  57.                                     WModuleHandle module=_ApplicationModule );
  58.  
  59.  
  60.         static void ConnectTransaction( WForm * parent,
  61.                                         WTransaction * trans,
  62.                                         const WChar * name, WBool connect );
  63.  
  64.         static void CreateQuery( WForm * parent, WQuery * query,
  65.                                  const WChar * trans_name,
  66.                                  const WChar * query_name );
  67.  
  68.         static void AutoOpenQuery( WForm * parent, WQuery * query );
  69.  
  70.         static WDataSource *GetDataSource( WForm * parent, const WChar * dsource_name );
  71.  
  72.         static WObject *GetObject( WForm *parent, const WChar *object_name,
  73.                                    WClassID id=0 );
  74.  
  75.         static void SetFormIcon( WForm * form, WBool mainForm,
  76.                                  const WResourceID & id,
  77.                                  WModuleHandle module=_ApplicationModule );
  78.  
  79.         static void RemoveObject( WForm *parent, WObject *object,
  80.                                   const WChar *object_name=NULL,
  81.                                   WClassID id=0 );
  82. };
  83.  
  84. struct WOptimaToolbarEventList {
  85.     WEventID            event;
  86.     WEventHandler       handler;
  87.     WToolbarItemHandle  item;
  88. };
  89.  
  90. class WCMCLASS WOptimaToolbarData : public WObject {
  91.     private:
  92.         struct WResourceToolbarItem {
  93.             WToolbarItemStyle           style;
  94.             WInt                        bitmapIndex;
  95.             WInt                        stringIndex;
  96.             WBool                       enabled;
  97.             WBool                       checked;
  98.             WBool                       pressed;
  99.             WBool                       indeterminate;
  100.             WBool                       hidden;
  101.             WBool                       lineBreak;
  102.             WBool                       inToolbar;
  103.             WInt                        textLength;
  104.             WInt                        toolTipTextLength;
  105.         };
  106.  
  107.         struct WResourceCustomImage {
  108.             WInt                resourceID;
  109.             WInt                numBitmaps;
  110.             WInt                isIcon;
  111.         };
  112.  
  113.         struct WResourceToolbar {
  114.             WBool                               usesStandardBitmaps;
  115.             WBool                               usesViewBitmaps;
  116.             WBool                               usesLargeBitmaps;
  117.             WInt                                bitmapSizeWidth;
  118.             WInt                                bitmapSizeHeight;
  119.             WInt                                buttonSizeWidth;
  120.             WInt                                buttonSizeHeight;
  121.             WInt                                numItems;
  122.             WToolbarItemInfoArray *             items;
  123.             WInt                                numCustomImages;
  124.             const WResourceCustomImage *        images;
  125.         };
  126.     public:
  127.         WOptimaToolbarData( WOptimaToolbarEventList events[], WObject * object, WToolbar * tb  );
  128.         ~WOptimaToolbarData();
  129.         WBool BuildToolbar( const WResourceID & id,
  130.                 WModuleHandle module=_ApplicationModule );
  131.  
  132.         WToolbarItemHandle GetHandle( WUInt index );
  133.  
  134.     protected:
  135.         WBool BuildToolbar( WResourceToolbar & toolbarResource,
  136.                 WModuleHandle moduleHandle );
  137.         WBool ToolbarEventHandler( WObject *, WToolbarEventData * event );
  138.  
  139.     private:
  140.         WObject *                       _object;
  141.         WOptimaToolbarEventList *       _events;
  142.         WToolbar *                      _toolbar;
  143.  
  144.         WBitmap **                      _images;
  145.         WInt                            _imagesSize;
  146.         WToolbarItemInfoArray           _items;
  147. };
  148.  
  149. extern class WOptimaCreateGlobal * TheFirstWOptimaCreateGlobal;
  150.  
  151. class WCMCLASS WOptimaCreateGlobal {
  152.     public:
  153.         WOptimaCreateGlobal( WObject * (*create)( WBool ),
  154.                             void (*destroy)( WObject * ),
  155.                             WOptimaCreateGlobal ** first );
  156.  
  157.         static void CreateGlobals( WOptimaCreateGlobal ** first );
  158.         static void DestroyGlobals( WOptimaCreateGlobal ** first );
  159.  
  160.     private:
  161.         WObject *       (*_createFN)( WBool doCreate );
  162.         void            (*_destroyFN)( WObject * item );
  163.  
  164.         WOptimaCreateGlobal *           _next;
  165. };
  166. #endif
  167.